<template>
	<view class="" style="display:flex;" v-if="show">
		<goodsItem v-for="(item,i) in goodsData" :key='i' :title="item.gName" :src="item.goodsImg" :money="item.price" style="margin:20rpx;" @click="toGoodsInfo(item.gid)"></goodsItem>
	</view>
</template>

<script setup>
	import goodsItem from '../components/18goodsItem.vue'
	import {ref} from 'vue'
	import { onLoad } from '@dcloudio/uni-app'
	import http from '../components/http.js'
	const goodsData = ref([])
	const show = ref(false)
	onLoad((options)=>{
		let {id} = options
		http.http({
			url:'/goods/fQueryGoodsAndfirstSkuByid?id='+id,
			method:'GET'
		}).then(res=>{
			goodsData.value = res.data.data
			show.value = true
		})
		
	})

	function toGoodsInfo(id){
		uni.navigateTo({
			url:`goodsInfo?id=${id}`
		})
	}
</script>

<style>
	page{
		/* background:#f9f9f9; */
	}
</style>